package org.arclib.x.sprite.frame;

import java.io.IOException;

import org.arclib.ResourceLoader;
import org.arclib.Texture;
import org.arclib.math.Size;
import org.arclib.sound.Sound;

public class RadFrame extends Frame
{
	public RadFrame(String argFullFileName, int argTime, Sound argSnd, Size s)
			throws IOException
	{
		size = init(argFullFileName, argTime, argSnd);
	}

	public RadFrame(Texture tex, int argTime, Sound argSnd, Size s)
	{
		size = init(tex, argTime, argSnd);
	}

	private Size init(String argFullFileName, int argTime, Sound argSnd)
			throws IOException
	{
		// turn image into an OpenGL texture
		setTexture(ResourceLoader.getTexture(argFullFileName));
		;

		ID = getTexture().getID();

		setTime(argTime);
		setSound(argSnd);

		return getTexture().getSize();
	}

	private Size init(Texture tex, int argTime, Sound argSnd)
	{
		ID = tex.getID();
		setTexture(tex);

		setTime(argTime);
		setSound(argSnd);

		return tex.getSize();
	}

	int getID()
	{
		return ID;
	}

	private int ID;
}
